(page-width 0) (n-pages 0)
page-cols pages keys/page page-widths)
(if (> (car (car cols-w-widths)) avl-width)
+ ;; give up if first column doesn't fit
(list :pages nil :page-height 0 :page-widths '(0)
:keys/page '(0) :n-pages 0 :tot-keys 0)
(dolist (col cols-w-widths)
(n-shown (nth i (plist-get which-key--pages-plist :keys/page)))
(n-tot (plist-get which-key--pages-plist :tot-keys))
(prefix-w-face (which-key--propertize-key prefix-keys))
- (prefix-width (string-width prefix-w-face))
- spaces)
+ (status-left (propertize (format "%s/%s" (1+ i) n-pages)
+ 'face 'font-lock-comment-face))
+ (status-top (propertize (format "[%s/%s]" (1+ i) n-pages)
+ 'face 'font-lock-comment-face))
+ (first-col-width (+ 2 (max (string-width prefix-w-face)
+ (string-width status-left))))
+ (prefix-left (s-pad-right first-col-width " " prefix-w-face))
+ (status-left (s-pad-right first-col-width " " status-left))
+ new-end lines)
(cond ((eq which-key-show-prefix 'left)
- (setq spaces (s-repeat prefix-width " ")
- page (concat
- prefix-w-face " "
- (s-replace "\n" (concat "\n " spaces) page))))
+ (setq lines (split-string page "\n")
+ first (concat prefix-left (car lines) "\n" status-left)
+ new-end (concat "\n" (s-repeat first-col-width " "))
+ page (concat first (mapconcat #'identity (cdr lines) new-end))))
((eq which-key-show-prefix 'top)
- (setq page (concat prefix-w-face "-\n" page))))
+ (setq page (concat prefix-w-face "- " status-top "\n" page))))
(which-key--lighter-status n-shown n-tot)
(if (eq which-key-popup-type 'minibuffer)
(let (message-log-max) (message "%s" page))